package com.my.service;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.my.domain.MyCase;
import com.my.mapper.MyCaseMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyCaseService extends ServiceImpl<MyCaseMapper, MyCase> {


    public List<MyCase> caseList(Integer id) {
        return list(lambdaQuery().getWrapper().eq(id !=null,MyCase::getType, id));
    }

    public void caseEdit(MyCase myCase) {
        if (ObjectUtil.isNull(myCase.getId())) {
            save(myCase);
            return;
        }
        updateById(myCase);
    }

    public void caseDeleted(String id) {
        removeById(id);
    }
}
